{% extends "common/layout_main.html" %}
{% block content %}
{% include "common/tab_food.html" %}
<div class="row mg-t20 wrap_food_set" style="">
    <div class="col-lg-12" style="">
        <h2 class="text-center">设置</h2>
        <div class="form-horizontal m-t" style="">
            <div class="form-group">
                <label class="col-lg-2 control-label">分类:</label>
                <div class="col-lg-10">
                    <select name="cat_id" class="form-control select2-hidden-accessible" tabindex="-1"
                            aria-hidden="true">
                        <option value="0">请选择分类</option>
                        {% for item in cat_list %}
                        <option value="{{ item.id }}" {% if item.id== food_info.cat_id %} selected {% endif %}>
                            {{ item.name }}
                        </option>
                        {% endfor %}
                    </select>
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <label class="col-lg-2 control-label">名称:</label>
                <div class="col-lg-10">
                    <input type="text" class="form-control" placeholder="请输入名称" name="name"
                           value="{{ food_info.name }}">
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <label class="col-lg-2 control-label">价格:</label>
                <div class="col-lg-10">
                    <input type="text" class="form-control" placeholder="请输入售价" name="price"
                           value="{{ food_info.price }}">
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <label class="col-lg-2 control-label">封面图:</label>
                <div class="col-lg-10">
                    <form class="upload_pic_wrap" target="upload_file" enctype="multipart/form-data" method="POST"
                          action="{{ buildUrl('/upload/pic') }}">
                        <div class="upload_wrap pull-left">
                            <i class="fa fa-upload fa-2x"></i>
                            <input type="file" name="pic" accept="image/png, image/jpeg, image/jpg,image/gif">
                        </div>
                        {% if food_info and food_info.main_image %}
                        <span class="pic-each">
                            <img src="{{ buildImageUrl(food_info.main_image) }}"/>
                            <span class="fa fa-times-circle del del_image" data="{{ food_info.main_image }}"></span>
                        </span>
                        {% endif %}
                    </form>
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group" style="">
                <label class="col-lg-2 control-label">描述:</label>
                <div class="col-lg-10">
                    <textarea id="editor" name="summary" style="height: 300px;">{{ food_info.summary }}</textarea>
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <label class="col-lg-2 control-label">库存:</label>
                <div class="col-lg-2">
                    <input type="text" name="stock" class="form-control" value="{{ food_info.stock }}">
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <label class="col-lg-2 control-label">标签:</label>
                <div class="col-lg-10">
                    <input type="text" class="form-control" name="tags" value="{{ food_info.tags }}">
                </div>
            </div>
            <div class="hr-line-dashed"></div>
            <div class="form-group">
                <div class="col-lg-4 col-lg-offset-2">
                    <input type="hidden" name="id" value="{{ food_info.id }}">
                    <button class="btn btn-w-m btn-outline btn-primary save">保存</button>
                </div>
            </div>
        </div>
    </div>
</div>
<iframe name="upload_file" class="hide"></iframe>
{% endblock %}
{% block css %}
<link href="{{ buildStaticUrl('/plugins/select2/select2.min.css') }}" rel="stylesheet">
<link href="{{ buildStaticUrl('/plugins/tagsinput/jquery.tagsinput.min.css') }}" rel="stylesheet">
{% endblock %}
{% block js %}
<script src="{{ buildStaticUrl('/plugins/ueditor/ueditor.config.js') }}"></script>
<script src="{{ buildStaticUrl('/plugins/ueditor/ueditor.all.min.js') }}"></script>
<script src="{{ buildStaticUrl('/plugins/ueditor/lang/zh-cn/zh-cn.js') }}"></script>
<script src="{{ buildStaticUrl('/plugins/select2/select2.pinyin.js') }}"></script>
<script src="{{ buildStaticUrl('/plugins/select2/zh-CN.js') }}"></script>
<script src="{{ buildStaticUrl('/plugins/select2/pinyin.core.js') }}"></script>
<script src="{{ buildStaticUrl('/plugins/tagsinput/jquery.tagsinput.min.js') }}"></script>
<script src="{{ buildStaticUrl('/js/food/set.js') }}"></script>
{% endblock %}
